(function (Class, Module, Role, Type, Prototype) {
return (function () {
var t = new Test.TAP.Class();
t.plan(14);

t.testCustomBuilders = function() {
    var self = this;
    Class("TestMeta", {
        isa: Joose.Class,
        
        methods: {
            handlePropcustomProp: function (paras, props) {
                var me = this;
                self.ok(paras, "received paras")
                self.ok(props, "received class properties")
                self.ok(paras.event1, "Received contents of paras")
                self.ok(props.has.one, "Received correct class props")
                Joose.O.each(paras, function (func,name) {
                    me.addMethod("custom"+name, func)
                })
            }
        }
    })
    
    
    Class("TheTestClass", {
        meta: TestMeta,
        has: {
            one: {
                is: "rw"
            },
            two: {
                is: "rw"
            }
        },
        
        methods: {
            test: function() {
                return true
            }
        },
        
        customProp: {
            event1: function () {
                return 1
            },
            event2: function () {
                return 2
            }
        }
    })
    
    self.ok(TestMeta, "TestMeta class is here")
    self.ok(TheTestClass, "TheTestClass is here")
    self.ok(TheTestClass.meta.meta.isa(TestMeta), "TheTestClass' meta class is of the correct type")
    self.ok(TheTestClass.meta.can("test"), "Regular method is here")
    self.ok(!TheTestClass.meta.can("event1"), "No method event1")
    self.ok(TheTestClass.meta.can("customevent1"), "Method event1 generated by customProp that is called as method on the meta class arrived")
    self.ok(TheTestClass.meta.can("customevent2"), "Method event2 generated by customProp that is called as method on the meta class arrived")
    
    var o = new TheTestClass();
    
    self.ok(o.test(), "Regular method call succeeds")
    self.ok(o.customevent1() == 1, "Method customevent1 from custom builder works")
    self.ok(o.customevent2() == 2, "Method customevent2 from custom builder works")
}

return t;
})()
}).call(window, JooseClass, JooseModule, JooseRole, JooseType, JoosePrototype)
